import { createStore } from 'vuex'

export default createStore({
  state: {
      num:100,
      sum:100,
      str:"vuex的数据"
  },
  getters: {
      total(state){
        return state.num * 2 
      }
  },
  mutations: {
    changeValue(state,value){
       state.num = value
       console.log(2,state.num)
    }
  },
  actions: {
    changeNum(){
      console.log(1111)
      //异步接受数据 setTimeout
    }
  },
  modules: {
    
  }
})
